import axios from 'axios'
import Vue from 'vue'
import Vuex from 'vuex'
import request from "../utils/axios"

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    name:"zhangsan",
    arr:[]
  },
  getters: {
  },
  mutations: {
      setName (state,payload) {
          state.name = payload
      },
      setArr (state,payload) {
          state.arr = payload
      }
  },
  actions: {
      getList({state,commit},payload){
          request.get("/list").then(res=>{
               commit("setArr",res.data)
          })
      }
  },
  modules: {
  }
})
